package com.zhiliao.iterator.demo2;

import java.util.ArrayList;
import java.util.List;

public class Iterator {
    private List<String> list = new ArrayList<>();
    private int idx = 0;

    public Iterator(List<String> list) {
        this.list = list;
    }

    public boolean hasNext() {
        return list.size() > idx;
    }

    public String next() {
        return list.get(idx++);
    }
}
